package com.cloudweb.oa.controller;

import com.cloudweb.oa.service.LeaveBalanceService;
import com.cloudweb.oa.vo.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HrController {

    @Autowired
    LeaveBalanceService leaveBalanceService;

    @ApiOperation(value = "根据规则分发假期余额", notes = "根据规则分发假期余额", httpMethod = "POST")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "Long"),
    })
    @ResponseBody
    @RequestMapping(value = "/hr/distributeLeaveBalanceByRuleId", method = RequestMethod.POST, produces = {"text/html;charset=UTF-8;", "application/json;"})
    public Result<Object> distributeLeaveBalanceByRuleId(Long id) {
        leaveBalanceService.distributeLeaveBalanceByRuleId(id, false);
        return new Result<>(true);
    }
}
